#!/bin/bash
###
 # @Version: 0.0.1
 # @Author: ider
 # @Date: 2021-08-18 18:38:22
 # @LastEditors: ider
 # @LastEditTime: 2021-08-18 18:49:08
 # @Description: 
### 

if [ ! -n "$1" ]; then
    echo "请输入需要创建的目录"
    exit
fi

echo "创建 redis 的 docker-compose.yml 在 位置:$1";
sleep 0.5
mkdir -p $1

cat > $1/docker-compose.yml<< EOF
version: '2.2'
services:
  redis:
    image: redis:alpine
    volumes:
      - /data/redis:/data
      - /etc/localtime:/etc/localtime
    ports:
      - 6379:6379
    command: 'redis-server --appendonly yes'
    restart: always
EOF